package com.houcine.services;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.houcine.dao.AuthorDAO;
import com.houcine.entity.Author;

@Transactional
public class AuthorService implements GenericService<Author> {

	private AuthorDAO dao;
	 
	public Author create(Author entity) {
		dao.save(entity);
		return entity;
	}
	 
	public void delete(Integer id) {
		Author entity = dao.getById(id);
		dao.delete(entity);
	}
	 
	public Author update(Author entity) {
		dao.save(entity);
		return entity;
	}
	 
	public List<Author> list(int page, int size) {
		return dao.list(page,size);
	}
	 
	public AuthorDAO getDao() {
		return dao;
	}
	 
	public void setDao(AuthorDAO dao) {
		this.dao = dao;
	}

	public Author get(Integer id) {
		return dao.getById(id);
	}
}
